# Contributor: knuxify <knuxify@gmail.com>
# Maintainer:
pkgname=clementine
pkgver=1.4.0_git20220324
pkgrel=12
_tag=1.4.0rc1-814-g2b340da79
pkgdesc="A modern music player and library organizer"
url="https://clementine-player.org"
arch="all"
license="GPL-3.0-or-later"
depends="gst-plugins-good"
makedepends="alsa-lib-dev
	boost-dev
	chromaprint-dev
	cmake
	fftw-dev
	glib-dev
	glu-dev
	gst-plugins-base-dev
	gstreamer-dev
	gtest-dev
	libcdio-dev
	libgpod-dev
	liblastfm-qt-dev
	libmtp-dev
	libmygpo-qt-dev
	libx11-dev
	projectm-dev
	protobuf-dev
	pulseaudio-dev
	qt5-qtbase-dev
	qt5-qttools-dev
	qt5-qtx11extras-dev
	samurai
	sparsehash
	taglib-dev
"
checkdepends="gtest-dev"
source="https://github.com/clementine-player/Clementine/releases/download/$_tag/clementine-$_tag.tar.xz
	cxx17.patch
	"
builddir="$srcdir/clementine-$_tag"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS -std=c++17 -Wno-error=format" \
		-DBUNDLE_PROJECTM_PRESETS=OFF \
		-DUSE_SYSTEM_PROJECTM=ON \
		-DUSE_SYSTEM_TAGLIB=ON \
		-DBUILD_WERROR=OFF \
		$CMAKE_CROSSOPTS
	cmake --build build
	cmake --build build --target build_tests
}

check() {
	cd "$builddir"/build/tests
	for test in *_test; do
		./$test
	done
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
38c826e91a23f3d23c30ad9cc34e84c141b4a09badfb08149eff7c6a2ded6e4dabd5a08671a8a82385ba56a2a2d3830ee96e839f86261e0e60180481db4b240a  clementine-1.4.0rc1-814-g2b340da79.tar.xz
7cf24bc057c17188084cc252ec2b049e66d27b272b7cfd50d99e1627a80800b5f81b7e5aa57fd551d70f32f864dbfcf13c19f945bfadbdce71a2671dd4b21cb9  cxx17.patch
"
